package com.homework.action;

import java.util.List;

import com.homework.bean.Record;
import com.homework.bean.Student;
import com.homework.dao.IDianmingDao;
import com.homework.dao.IStudentDao;
import com.homework.daoImpl.DianmingDaoImpl;
import com.homework.daoImpl.StudentDaoImpl;
import com.opensymphony.xwork2.ActionSupport;

public class DianmingAction extends ActionSupport {
	private static final long serialVersionUID = 1L;

	private List<Student> students;
	private List<Record> records;
	private IStudentDao studentDao = new StudentDaoImpl();
	private IDianmingDao dianmingDao = new DianmingDaoImpl();
	private String history;

	public String dianming() {
		students = studentDao.findAll();
		return SUCCESS;
	}

	public String history() {
		if ("today".equals(history)) {
			records = dianmingDao.find(1);
		} else {
			records = dianmingDao.find(0);
		}
		return SUCCESS;
	}

	public List<Student> getStudents() {
		return students;
	}

	public void setStudents(List<Student> students) {
		this.students = students;
	}

	public IStudentDao getStudentDao() {
		return studentDao;
	}

	public void setStudentDao(IStudentDao studentDao) {
		this.studentDao = studentDao;
	}

	public String getHistory() {
		return history;
	}

	public void setHistory(String history) {
		this.history = history;
	}

	public List<Record> getRecords() {
		return records;
	}

	public void setRecords(List<Record> records) {
		this.records = records;
	}
}
